const {contextBridge, ipcRenderer, protocol} = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
    system: () => ipcRenderer.invoke('dialog:system'),
    mkvtoolnix: () => ipcRenderer.invoke('dialog:mkvtoolnix'),
    openFile: () => ipcRenderer.invoke('dialog:openFile'),
    start: (mkvtoolnix, data, threadCount) => ipcRenderer.send('dialog:start', mkvtoolnix, data, threadCount),
    handleResult: (callback) => ipcRenderer.on('update-result', callback),
    handleFinishPercent: (callback) => ipcRenderer.on('update-finishPercent', callback),
    handleFinish: (callback) => ipcRenderer.on('update-finish', callback),
    saveMediaInfo: (path, data) => ipcRenderer.invoke('mi:saveMediaInfo', path, data),
    getMediaInfo: (path) => ipcRenderer.invoke('mi:getMediaInfo', path),
    getMediaInfoXml: (path) => ipcRenderer.invoke('mi:getMediaInfoXml', path),
    getConf: (path) => ipcRenderer.invoke('conf:getConf'),
    getTranslateConf: () => ipcRenderer.invoke('conf:getTranslateConf'),
    getFixed: (path) => ipcRenderer.invoke('mi:getFixed', path),
    getNfo: (path) => ipcRenderer.invoke('mi:getNfo', path),
    minimize: () => ipcRenderer.send('app:minimize'),
    maximize: () => ipcRenderer.send('app:maximize'),
    close: () => ipcRenderer.send('app:close'),
    openDevTools: () => ipcRenderer.send('app:openDevTools'),
})
// console.log(protocol)
// protocol.registerSchemesAsPrivileged("app")
// console.log(webFrame)
// webFrame.registerURLSchemeAsPrivileged("app");